﻿﻿using System;
using System.Collections;
using System.Collections.Generic;

using UnityEngine;

namespace ALPackage
{
    /*********************
     * UI系统层级管理对象的所有层级节点的接口类
     **/
    public class ALUILayerNodeCanvasObj : _IALUILayerBasicNodeObj
    {
        private Canvas _m_coCanvasObj;
        private Transform _m_cgoCanvasTrans;

        public ALUILayerNodeCanvasObj(Canvas _canvas)
        {
            _m_coCanvasObj = _canvas;

            if(null != _m_coCanvasObj)
                _m_cgoCanvasTrans = _m_coCanvasObj.transform;
        }

        /// <summary>
        /// 当前所在节点对应的canvas对象
        /// </summary>
        public Transform transF { get { return _m_cgoCanvasTrans; } }
        /// <summary>
        /// 设置当前的层级信息
        /// </summary>
        /// <param name="_layer"></param>
        public void setOrderInLayer(int _sortingLayer, int _layer)
        {
            if(null == _m_coCanvasObj || null == _m_cgoCanvasTrans)
                return;

            _m_coCanvasObj.sortingLayerID = _sortingLayer;
            _m_coCanvasObj.sortingOrder = _layer;
        }
        /// <summary>
        /// 资源释放函数
        /// </summary>
        public void discard()
        {
            _m_coCanvasObj = null;
            _m_cgoCanvasTrans = null;
        }
    }
}
